<!DOCTYPE html>

<html class="no-js">

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <title></title>
  <meta name="description" content="" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <script src="https://cdn.bootcss.com/axios/0.19.0-beta.1/axios.js"></script>
  <script src="https://cdn.bootcss.com/vue/2.5.17/vue.js"></script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/element-ui/2.11.0/theme-chalk/index.css" />
  <script src="https://cdnjs.cloudflare.com/ajax/libs/element-ui/2.11.0/index.js"></script>
  <link rel="stylesheet" href="https://cdn.bootcss.com/animate.css/3.7.0/animate.min.css" />
  <link rel="stylesheet" href="../../../lib/index.css" />
  <script src="../../../lib/avue.js"></script>
  <style>
    .imagepreview-1-vue img {
      width: 60px;
      cursor: pointer;
      margin-right: 10px;
      border-radius: 4px;
    }

    .imagepreview-1-vue img:hover {
      box-shadow: 0 0 6px rgb(63, 63, 63);
    }
  </style>
</head>

<body>
  <div id="app">
    <div class="imagepreview-1-vue">
      <el-button @click="openPreview(0)">打开图片预览</el-button>
      <p>
        <img v-for="(d, index) of datas" :src="d.thumbUrl" @click="openPreview(index)">
      </p>
    </div>
  </div>
</body>
<script>
  new Vue({
    el: '#app',
    data() {
      const link = 'https://lokeshdhakar.com/projects/lightbox2/images/';
      return {
        datas: [
          { thumbUrl: `${link}thumb-4.jpg`, url: `${link}image-4.jpg` },
          { thumbUrl: `${link}thumb-5.jpg`, url: `${link}image-5.jpg` },
          { thumbUrl: `${link}thumb-6.jpg`, url: `${link}image-6.jpg` },
        ]
      }
    },
    methods: {
      openPreview(index = 0) {
        this.$ImagePreview(this.datas, index);
      }
    }
  })
</script>

</html>